--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 2d81b47b6ab0fbd0a57284413d8b2f4309c46f02
Parents : 1c4928a
Author : Mark Qvist <mark@unsigned.io>
Date : 2022-10-22T21:25:15+02:00
Added peering settings to lxmd
Changes
2 files changed, 22 insertions(+), 2 deletions(-)
Diff
diff --git a/LXMF/LXMRouter.py b/LXMF/LXMRouter.py
index fa9ea51..376f118 100644
--- a/LXMF/LXMRouter.py
+++ b/LXMF/LXMRouter.py
@@ -976,7 +976,8 @@ class LXMRouter:
remote_hash = remote_destination.hash
if not remote_hash in self.peers:
- self.peer(remote_hash, remote_timebase)
+ if self.autopeer and RNS.Transport.hops_to(remote_hash) <= self.autopeer_maxdepth:
+ self.peer(remote_hash, remote_timebase)
messages = data[1]
for lxmf_data in messages:
diff --git a/LXMF/Utilities/lxmd.py b/LXMF/Utilities/lxmd.py
index 147e131..a089e16 100644
--- a/LXMF/Utilities/lxmd.py
+++ b/LXMF/Utilities/lxmd.py
@@ -94,6 +94,16 @@ def apply_config():
else:
active_configuration["node_announce_at_start"] = False
+ if "propagation" in lxmd_config and "autopeer" in lxmd_config["propagation"]:
+ active_configuration["autopeer"] = lxmd_config["propagation"].as_bool("autopeer")
+ else:
+ active_configuration["autopeer"] = True
+
+ if "propagation" in lxmd_config and "autopeer_maxdepth" in lxmd_config["propagation"]:
+ active_configuration["autopeer_maxdepth"] = lxmd_config["propagation"].as_int("autopeer_maxdepth")
+ else:
+ active_configuration["autopeer_maxdepth"] = None
+
if "propagation" in lxmd_config and "announce_interval" in lxmd_config["propagation"]:
active_configuration["node_announce_interval"] = lxmd_config["propagation"].as_int("announce_interval")*60
else:
@@ -241,7 +251,12 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
exit(2)
# Start LXMF
- message_router = LXMF.LXMRouter(identity = identity, storagepath = storagedir, autopeer = True)
+ message_router = LXMF.LXMRouter(
+ identity = identity,
+ storagepath = storagedir,
+ autopeer = active_configuration["autopeer"],
+ autopeer_maxdepth = active_configuration["autopeer_maxdepth"],
+ )
message_router.register_delivery_callback(lxmf_delivery)
for destination_hash in active_configuration["ignored_lxmf_destinations"]:
@@ -371,6 +386,10 @@ announce_at_start = yes
# propagation nodes on the network.
autopeer = yes
+# The maximum peering depth (in hops) for
+# automatically peered nodes.
+autopeer_maxdepth = 4
+
# The maximum amount of storage to use for
# the LXMF Propagation Node message store,
# specified in megabytes. When this limit
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────